package org.jsola.hr.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.hr.dto.AttendPunchRecordAddDTO;
import org.jsola.hr.dto.AttendPunchRecordUpdateDTO;
import org.jsola.hr.dto.excel.AttendPunchRecordImportDTO;
import org.jsola.hr.query.AttendPunchRecordQuery;
import org.jsola.hr.vo.AttendPunchRecordListVO;
import org.jsola.hr.vo.AttendPunchRecordVO;
import org.jsola.hr.vo.excel.AttendanceSheetResultVO;
import org.jsola.hr.vo.excel.ParseResultVO;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author zhr
 */
@Api(tags = "hr-考勤打卡记录")
public interface IAttendPunchRecordControllerAPI {

    /**
     * 根据考勤计算工资
     * @param attendanceSheetResultVO 解析考勤表类
     * @return 计算工资后结果
     */
    @ApiOperation(value = "根据考勤计算工资")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendanceSheetResultVO", dataType = "AttendanceSheetResultVO", value = "解析考勤表类,attendFiledInfo内层Map需要全部赋值，key为工资，value为是否工资项，1增项-1为减项0为否", paramType = "body")
    })
    Result<AttendanceSheetResultVO> calculateSalaryByAttendPunch(AttendanceSheetResultVO attendanceSheetResultVO);

    /**
     * 解析excel考勤表
     * @param file 上传的文件
     * @param startCol 需要识别的开始列数
     * @param endCol 需要识别的结束列数
     * @param nameCol 需要识别的人员名字列数
     * @param startRow 需要识别的开始行数
     * @return 解析结果
     */
    @ApiOperation(value = "解析excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file", value = "文件，Content-Type需要设置为multipart/form-data", paramType = "formData",dataType = "file",required = true),
            @ApiImplicitParam(name = "startCol", value = "需要识别的开始列数，只包含工种和天数",required = true),
            @ApiImplicitParam(name = "endCol", value = "需要识别的结束列数，只包含工种和天数",required = true),
            @ApiImplicitParam(name = "nameCol", value = "需要识别的人员名字列数",required = true),
            @ApiImplicitParam(name = "startRow", value = "需要识别的开始行数",required = true)
    })
    Result<AttendanceSheetResultVO> parseExcelAttendanceSheet(MultipartFile file,Integer startCol,Integer endCol,Integer nameCol,Integer startRow);

    /**
     * 新增考勤打卡记录
     * @param attendPunchRecordAddDTO 考勤打卡记录新增实体
     * @return 考勤打卡记录展示对象
     */
    @ApiOperation(value = "新增考勤打卡记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordAddDTO", dataType = "AttendPunchRecordAddDTO", value = "新增考勤打卡记录", paramType = "body")
    })
    Result<AttendPunchRecordVO> save(AttendPunchRecordAddDTO attendPunchRecordAddDTO);


    /**
     * 修改考勤打卡记录
     * @param attendPunchRecordUpdateDTO 考勤打卡记录
     * @return 更新数量
     */
    @ApiOperation(value = "修改考勤打卡记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordUpdateDTO", dataType = "AttendPunchRecordUpdateDTO", value = "修改考勤打卡记录", paramType = "body")
    })
    Result<Integer> update(AttendPunchRecordUpdateDTO attendPunchRecordUpdateDTO);




    /**
     * 删除单个考勤打卡记录，彻底删除
     * @param attendPunchRecordId 考勤打卡记录id
     * @return 删除数量
     */
    @ApiOperation(value="删除单个考勤打卡记录，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordId", dataType = "String", value = "考勤打卡记录id", paramType = "path")
    })
    Result<Integer> delete(String attendPunchRecordId);


    /**
     * 批量删除考勤打卡记录，彻底删除
     * @param attendPunchRecordIds 考勤打卡记录id集合
     * @return 删除数量
     */
    @ApiOperation(value = "批量删除考勤打卡记录，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordIds", dataType = "String[]", value = "考勤打卡记录id数组", paramType = "body" ,allowMultiple = true)
    })
    Result<Integer> deleteBatch(String[] attendPunchRecordIds);


    /**
     * 根据考勤打卡记录id查询考勤打卡记录详情
     * @param attendPunchRecordId 考勤打卡记录id
     * @return 考勤打卡记录详情
     */
    @ApiOperation(value="根据考勤打卡记录id查询考勤打卡记录详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordId", dataType = "String", value = "考勤打卡记录id", paramType = "path")
    })
    Result<AttendPunchRecordVO> findById(String attendPunchRecordId);


    /**
     * 查询考勤打卡记录
     * @param attendPunchRecordQuery 考勤打卡记录查询参数
     * @return page
     */
    @ApiOperation(value="查询考勤打卡记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordQuery", dataType = "AttendPunchRecordQuery", value = "考勤打卡记录查询参数", paramType = "query")
    })
    Result<List<AttendPunchRecordListVO>> listAll(AttendPunchRecordQuery attendPunchRecordQuery);


     /**
     * 分页查询考勤打卡记录
     * @param attendPunchRecordQuery 考勤打卡记录查询参数
     * @return page
     */
    @ApiOperation(value="分页查询考勤打卡记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordQuery", dataType = "AttendPunchRecordQuery", value = "考勤打卡记录查询参数", paramType = "query")
    })
    Result<Page<AttendPunchRecordListVO>> page(AttendPunchRecordQuery attendPunchRecordQuery);

    /**
     * 考勤打卡记录导出excel
     * @param attendPunchRecordQuery 考勤打卡记录查询参数
     * @return excel
     */
    @ApiOperation(value = "考勤打卡记录导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordQuery", dataType = "AttendPunchRecordQuery", value = "考勤打卡记录查询参数", paramType = "query")
    })
    ResponseEntity<Resource> export(AttendPunchRecordQuery attendPunchRecordQuery);

    /**
     * 解析excel
     * @param file 上传的文件
     * @param success true返回成功的，false返回失败的，不传返回全部
     * @return 解析结果
     */
    @ApiOperation(value = "解析excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file", value = "文件，Content-Type需要设置为multipart/form-data", paramType = "form"),
            @ApiImplicitParam(name = "success", dataType = "Boolean", value = "true返回成功的，false返回失败的，不传返回全部", paramType = "query")
    })
    Result<List<ParseResultVO<AttendPunchRecordImportDTO>>> parseImportFile(MultipartFile file, Boolean success);

     /**
     * 导入excel
     * @param file 上传的文件
     * @param force true忽略错误的行，false有错误中断上传
     * @return 导入成功数量
     */
    @ApiOperation(value = "导入excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file",
                    value = "文件，Content-Type需要设置为multipart/form-data",
                    paramType = "form"),
            @ApiImplicitParam(name = "force", dataType = "Boolean", value = "true忽略错误的行，false有错误中断", paramType = "query")
    })
    Result<Integer> importFile(MultipartFile file, Boolean force);

    /**
     * 分页查询考勤打卡记录
     * @param attendPunchRecordQuery 考勤打卡记录查询参数
     * @return page
     */
    @ApiOperation(value="分页查询考勤打卡记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordQuery", dataType = "AttendPunchRecordQuery", value = "考勤打卡记录查询参数", paramType = "query")
    })
    Result<Page<AttendPunchRecordVO>> selectAttendPunchRecord(AttendPunchRecordQuery attendPunchRecordQuery);

    /**
     * 分页查询某员工的某月的打卡记录
     * @param attendPunchRecordQuery 考勤打卡记录查询参数
     * @return page
     */
    @ApiOperation(value="分页查询某员工的某月的打卡记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordQuery", dataType = "AttendPunchRecordQuery", value = "考勤打卡记录查询参数", paramType = "query")
    })
    Result<Page<AttendPunchRecordVO>> selectAttendMonth(AttendPunchRecordQuery attendPunchRecordQuery);

    /**
     * 查询某员工的某月的打卡记录
     * @param attendPunchRecordQuery 考勤打卡记录查询参数
     * @return page
     */
    @ApiOperation(value="查询某员工的某月的打卡记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordQuery", dataType = "AttendPunchRecordQuery", value = "考勤打卡记录查询参数", paramType = "query")
    })
    Result<List<AttendPunchRecordVO>> selectAttendYearMonth(AttendPunchRecordQuery attendPunchRecordQuery);


    /**
     * 分页查询某一日的考勤记录
     * @param attendPunchRecordQuery 考勤打卡记录查询参数
     * @return page
     */
    @ApiOperation(value="分页查询某一日的考勤记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordQuery", dataType = "AttendPunchRecordQuery", value = "考勤打卡记录查询参数", paramType = "query")
    })
    Result<Page<AttendPunchRecordVO>> selectAttendByDay(AttendPunchRecordQuery attendPunchRecordQuery);

    /**
     * 查询某个人某一天的打卡信息
     * @param attendPunchRecordQuery 考勤打卡记录查询参数
     * @return page
     */
    @ApiOperation(value="查询某个人某一天的打卡信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordQuery", dataType = "AttendPunchRecordQuery", value = "考勤打卡记录查询参数", paramType = "query")
    })
    Result<List<AttendPunchRecordVO>> selectAttendByDayAndEmpId(AttendPunchRecordQuery attendPunchRecordQuery);


    /**
     * 考勤打卡导出列表
     * @param attendPunchRecordQuery 考勤打卡记录查询参数
     * @return page
     */
    @ApiOperation(value="考勤打卡导出列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordQuery", dataType = "AttendPunchRecordQuery", value = "考勤打卡记录查询参数", paramType = "query")
    })
    ResponseEntity<Resource> exportAttendPunchRecord(AttendPunchRecordQuery attendPunchRecordQuery);

    /**
     * 导出列表某员工的某月的打卡记录
     * @param attendPunchRecordQuery 考勤打卡记录查询参数
     * @return page
     */
    @ApiOperation(value="导出列表某员工的某月的打卡记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordQuery", dataType = "AttendPunchRecordQuery", value = "考勤打卡记录查询参数", paramType = "query")
    })
    ResponseEntity<Resource> exportAttendMonth(AttendPunchRecordQuery attendPunchRecordQuery);

    /**
     * 导出某一日的考勤记录
     * @param attendPunchRecordQuery 考勤打卡记录查询参数
     * @return page
     */
    @ApiOperation(value="导出某一日的考勤记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "attendPunchRecordQuery", dataType = "AttendPunchRecordQuery", value = "考勤打卡记录查询参数", paramType = "query")
    })
    ResponseEntity<Resource> exportAttendByDay(AttendPunchRecordQuery attendPunchRecordQuery);
}

